/**
 * Breadcrumb 组件的主题配置
 * 
 * 基于企业级设计规范 (Breadcrumb.json) 的完整配置
 * 面包屑组件样式定义
 */

import type { ComponentToken } from 'antd/es/breadcrumb/style';

// ========== 设计 Token 常量 ==========

/**
 * 颜色相关 Token
 */
const COLOR_TOKENS = {
  itemColor: '#8c8c8c',
  lastItemColor: '#1a1a1a',
  linkColor: '#8c8c8c',
  linkHoverColor: '#1a1a1a',
  separatorColor: '#8c8c8c',
} as const;

/**
 * 间距相关 Token
 */
const SPACING_TOKENS = {
  separatorMargin: 8,
} as const;

/**
 * 字体相关 Token
 */
const FONT_TOKENS = {
  iconFontSize: 14,
} as const;

/**
 * Breadcrumb 完整主题配置
 * 
 * 根据设计规范文件 Breadcrumb.json 定义的面包屑组件样式
 * 
 * @example
 * ```tsx
 * <ConfigProvider theme={{ components: { Breadcrumb: breadcrumbThemeConfig } }}>
 *   <Breadcrumb>
 *     <Breadcrumb.Item>首页</Breadcrumb.Item>
 *     <Breadcrumb.Item>列表</Breadcrumb.Item>
 *   </Breadcrumb>
 * </ConfigProvider>
 * ```
 */
export const breadcrumbThemeConfig: Partial<ComponentToken> = {
  // ========== 颜色配置 ==========
  itemColor: COLOR_TOKENS.itemColor,
  lastItemColor: COLOR_TOKENS.lastItemColor,
  linkColor: COLOR_TOKENS.linkColor,
  linkHoverColor: COLOR_TOKENS.linkHoverColor,
  separatorColor: COLOR_TOKENS.separatorColor,

  // ========== 间距配置 ==========
  separatorMargin: SPACING_TOKENS.separatorMargin,

  // ========== 字体配置 ==========
  iconFontSize: FONT_TOKENS.iconFontSize,
};

/**
 * 获取面包屑主题配置
 * 
 * @param customConfig 自定义配置（可选）
 * @returns 合并后的主题配置
 * 
 * @example
 * ```tsx
 * const myBreadcrumbTheme = getBreadcrumbTheme({
 *   linkColor: '#1890ff',
 *   linkHoverColor: '#40a9ff',
 * });
 * 
 * <ConfigProvider theme={{ components: { Breadcrumb: myBreadcrumbTheme } }}>
 *   <Breadcrumb><Breadcrumb.Item>首页</Breadcrumb.Item></Breadcrumb>
 * </ConfigProvider>
 * ```
 */
export const getBreadcrumbTheme = (
  customConfig?: Partial<ComponentToken>
): Partial<ComponentToken> => {
  return {
    ...breadcrumbThemeConfig,
    ...customConfig,
  };
};

/**
 * 导出 Breadcrumb 组件的 Token 类型
 */
export type { ComponentToken as BreadcrumbComponentToken } from 'antd/es/breadcrumb/style';

